$(function(){
  var page = 2;
  $(window).scroll(function(){
	var scrollTop = parseFloat($(this).scrollTop());
	var scrollHeight = parseFloat($(document).height());
	var windowHeight = parseFloat($(this).height());
	var count = $('.orderreseller .count').text();
	var order_status = $('.orderreseller .order-status').text();
	var url = hostUrl()+'line/lineorder/order_reseller';
	if( page <= count ){
		if( scrollTop + windowHeight >= scrollHeight ) {
	    	   $.ajax({
	    			type:'get',
	    			url :url,
	    			data:{'page':page,'order_status':order_status},
	    		    dataType:'json',
	    		    async: false,
	    		    beforeSend:function(XMLHttpRequest){},
	    		    success:function(json){
	    		    	if(json.status){
	    		    		$('.wap_hOrderMain0811 a').last().after(json.content);
	    		            page++;
	    		    	}
	    		     }
	    		 })
	    }
	}
  });
});
  